﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace ciiattack
{
    public abstract class Actor
    {
        Texture2D texture;
        Vector2 origin;
        protected SpriteBatch spriteBatch;
        protected Vector2 position;
        private Rectangle boundingRectangle;
        int score = 0;

        public Rectangle BoundingRectangle
        {
            get { return boundingRectangle; }
        }

        public Actor(Texture2D texture, Vector2 origin, SpriteBatch spriteBatch, Vector2 initialPosition)
        {
            this.texture = texture;
            this.origin = origin;
            this.spriteBatch = spriteBatch;
            this.position = initialPosition;
            boundingRectangle = new Rectangle((Int32)(initialPosition.X - origin.X), (Int32)(initialPosition.Y - origin.Y), texture.Width, texture.Height);
        }

        public virtual void Update(GameTime gameTime)
        {
        }

        public virtual int Update(GameTime gameTime, SpriteFont scr, int resultat)
        {
            return resultat;
        }

        public virtual void Draw(GameTime gameTime)
        {
            this.spriteBatch.Draw(texture, new Vector2(position.X - origin.X, position.Y - origin.Y), Color.White);
        }

        public Vector2 Position
        {
            get { return position; }
            set
            {
                position = value;

                boundingRectangle = new Rectangle((Int32)(position.X - origin.X), (Int32)(position.Y - origin.Y), texture.Width, texture.Height);
            }
        }
    }
}